package com.mengtian_tech.tju.dataquery.api.task;

import javax.annotation.PreDestroy;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;

@Component
public class SchedulerDestroyer {

	@Autowired
	private ThreadPoolTaskScheduler taskScheduler;

	@PreDestroy
	public void preDestroy() {
		System.out.println("SchedulerDestroyer preDestroy");
		taskScheduler.shutdown();
		taskScheduler.setAwaitTerminationSeconds(60);//最多等待1分钟
	}
}
